<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp"%>
<style>
</style>
<script type="text/javascript">
    $(function() {
    	$('#processTypeEditPid').combotree({
            url : '${path }/processType/tree?flag=false',
            parentField : 'pid',
            lines : true,
            panelHeight : 'auto',
            value :'${processType.pid}'
        });
        $('#processTypeEditForm').form({
            url : '${path}/processType/edit',
            onSubmit : function() {
                progressLoad();
                var isValid = $(this).form('validate');
                if (!isValid) {
                    progressClose();
                }
                return isValid;
            },
            success : function(result) {
                progressClose();
                result = $.parseJSON(result);
                if (result.success) {
                    showMsg(result.msg);
                    parent.$.modalDialog.openner_treegrid.treegrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了
                    parent.$.modalDialog.handler.dialog('close');
                } else {
                    var form = $('#processTypeEditForm');
                    parent.$.messager.alert('错误', result.msg, 'error');
                }
            }
        });
        if('${processType.type}'=='0'){
        	$('#processTypeEdit_procdefid').attr("disabled",true);
    		$('#processTypeEdit_key').attr("disabled",true);
    		$('#processTypeEdit_version').attr("disabled",true);
        }
        $('#processTypeEdit_type').val('${processType.type}');
        $('#processTypeEdit_type').change(function(){
        	var val=$(this).val();
        	if(val==0){
        		$('#processTypeEdit_procdefid').attr("disabled",true);
        		$('#processTypeEdit_key').attr("disabled",true);
        		$('#processTypeEdit_version').attr("disabled",true);
        	}else{
        		$('#processTypeEdit_procdefid').attr("disabled",false);
        		$('#processTypeEdit_key').attr("disabled",false);
        		$('#processTypeEdit_version').attr("disabled",false);
        	}
        })
    });
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false" title=""
		style="overflow-x: hidden; overflow-y: auto; padding: 3px;">
		<form id="processTypeEditForm" method="post">
			<table class="grid">
				<tr>
					<td>名称</td>
					<td><input name='name'  type='text'
						placeholder='请输入名称' class='easyui-text-2  span2'
						value='${processType.name}'></td>
						 <td>类型</td>
                     <td>
                     	<select id="processTypeEdit_type" class="easyui-text-2 easyui-validatebox" data-options="required:true" name="type">
                     		<option value="">请选择</option>
                     		<option value="0">分类</option>
                     		<option value="1">流程</option>
                     	</select>
                     </td>
				</tr>
				<tr>
					<td>排序</td>
					<td><input name='seq'  type='text' placeholder='请输入排序'
						class='easyui-text-2  span2' value='${processType.seq}'></td>
					<td>流程定义ID</td>
				 	<td>
				 		<input type="text" name="procdefid" id="processTypeEdit_procdefid" class="easyui-text-2 easyui-validatebox" data-options="required:true" value='${processType.procdefid}'/>
				 	</td>
				</tr>
				<tr>
					<td>图标</td>
                <td>
                <input type="text" class="easyui-text-2" name="iconCls" value="${processType.iconCls}"/>
                </td>
                 <td>版本</td>
	                <td>
	                	<input type="text" class="easyui-text-2" name="version" placeholder="请输入版本号" id="processTypeEdit_version"  value="${processType.version}"/>
	                </td>
				</tr>
				<tr>
				<td>key值</td>
					<td>
					<input type="hidden" name="id" value="${processType.id}"/>
					<input name='key' id='processTypeEdit_key' type='text'
						placeholder='请输入key值' class='easyui-text-2  span2'
						value='${processType.key}'></td>
					<td>部署ID</td>
					<td><input type="text" name="deploymentId" class="easyui-text-2" value="${processType.deploymentId}"></td>
				</tr>
				 <tr>
                <td>上级</td>
                <td colspan="3"><select id="processTypeEditPid" name="pid" style="width: 200px; height: 29px;"></select>
                <a class="easyui-linkbutton" href="javascript:void(0)" onclick="$('#processTypeEditPid').combotree('clear');" >清空</a></td>
            </tr>
			</table>
		</form>
	</div>
</div>